package com.suyafei.exception;

import com.suyafei.enums.BizCodeEnum;
import lombok.Data;

/**
 * @program: suyafei-1024-shop
 * @description
 * @author: luffy
 * @create: 2021-01-28 15:48
 */
@Data
public class BizException extends RuntimeException {

    private int code;
    private String msg;

    public BizException(int code, String msg
    ) {
        this.code = code;
        this.msg = msg;
    }

    public BizException(BizCodeEnum bizCodeEnum) {
        super(bizCodeEnum.getMessage());
        this.code = bizCodeEnum.getCode();
        this.msg = bizCodeEnum.getMessage();

    }
}
